package cn.tfinfo.microservice.mes.konka.persistance.dao.chemActivity;

import cn.tfinfo.microservice.mes.basic.common.entity.statemodel.McComStatetransEntity;
import cn.tfinfo.microservice.mes.konka.common.entity.chemActivity.McMtmChemActRecordEntity;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

/**
 * 化学品活动事件数据库层
 * @author JiPing
 * @Date 2020-3-19 11:09:45
 */
@Repository
public interface McMtmChemActDao {

    /**
     * 保存工治具(化学品)事件活动记录
     *
     * @param entity
     * @return
     */
    int saveActRecord(McMtmChemActRecordEntity entity);

    /**
     * 根据选择的事件取事件模式转换定义中的目标状态（MC_COM_STATETRANS.TO_STATE )
     *
     * @param eventCode
     * @return
     */
    McComStatetransEntity findToState(@Param("eventCode") String eventCode, @Param("fromState") String fromState);

    /**
     * 查询当前化学品状态下是否可用(MC_COM_STATE.AVAILABLE_FLAG)
     *
     * @param newState
     * @return
     */
    String findAvailableFlag(@Param("newState") String newState);

    /**
     * 根据id查询活动记录信息
     * @param id
     * @return
     */
    McMtmChemActRecordEntity findRecordById(@Param("id") String id);

    /**
     * 根据化学品ID和前置活动code查前置活动记录
     *
     * @param toolingId
     * @param preactivityCode
     * @return
     */
    McMtmChemActRecordEntity findRecord(@Param("toolingId") String toolingId,@Param("preactivityCode") String preactivityCode);
}
